package org.xxforest.game.notsing.screen.rpg.layers;

import org.xxforest.game.core.XX;
import org.xxforest.game.core.scenes.scene2d.XXFloatLayer;
import org.xxforest.game.core.scenes.scene2d.XXLayer;
import org.xxforest.game.core.scenes.scene2d.selector.XXScheduleSelector;
import org.xxforest.game.core.scenes.scene2d.ui.XXLable;

import com.badlogic.gdx.Gdx;

public class FloatLayer extends XXFloatLayer{

	public FloatLayer(float width, float height) {
		super(width, height);
	}

	@Override
	public void onCreate() {
		
		final XXLable lable = XXLable.create("FPS:0");
		lable.setPosition(0,XX.data.getHeight());
		
		this.add(lable);
		
		XX.director.addSelector(new XXScheduleSelector() {
			@Override
			public void run() {
				lable.setText("FPS:"+Gdx.graphics.getFramesPerSecond());
			}
		}, 0.2f);
		
	}

	public static XXLayer create() {
		return new FloatLayer(0, 0);
	}
	
	

}
